home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 May: Tool Chest / Developer CD Series Tool Chest (Apple Computer)(May 1999).iso / Tool Chest / Development Kits / MPW Related / MPW Script Tips 1.1.1 / Sample Scripts / WhatLine < prev   
Encoding:
Text File  |  1991-08-16  |  1.2 KB  |  37 lines  |  [TEXT/MPS ]

  1. #-------------------------------------------------------------------------------
  2. #    WhatLine
  3. #    MPW Shell Script
  4. #    Written by Gina Cherry • August 16, 1991
  5. #    Copyright:    © 1991 by Apple Computer, Inc., all rights reserved.
  6. #    
  7. #    Usage:
  8. #                WhatLine [Window]
  9. #                
  10. #    Function:
  11. #                WhatLine displays an alert dialog box with the current line number of the specified 
  12. #                window.  If no window is specified, WhatLine operates on the target window.
  13. #
  14. #    WhatLine can be added to the Commands menu with the following command:
  15. #
  16. #            AddMenu Commands 'What Line' 'WhatLine "{Active}"'
  17. #-------------------------------------------------------------------------------
  18.  
  19. # Do not exit on error.
  20.     Set Exit 0                                                            
  21.  
  22. # If more than one parameter is given, write an error message and exit the script.
  23.     If {#} > 1                                                        
  24.         Echo "###Usage: {0} [Window]" 
  25.         Exit 1
  26.     End >> Dev:StdErr
  27.  
  28. # Set Window to the parameter if one was given; otherwise set Window to the target window.
  29.     If {#} == 1                                                    
  30.         Set Window "{1}"                                        
  31.     Else
  32.         Set Window "{Target}"
  33.     End
  34.  
  35. # Display the current line number of Window in an alert dialog.  The Position command will 
  36. #    generate an error message if Window  is not a valid window.
  37.     Alert "Current line number: `Position -l "{Window}"`"